package com.linked.goods.goodsfind.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.linked.goods.goodsfind.bean.po.GoodsFindPO;
import com.linked.goods.goodsfind.service.IGoodsFindService;
import com.linked.universal.common.LinkedPrompt;
import com.linked.universal.common.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author :dbq
 * @date : 2023/7/10 16:10
 * @description : desc
 */
@RestController
@RequestMapping("goodsfind")
@Slf4j
public class GoodsFindController {

    private final IGoodsFindService goodsFindService;

    private final ObjectMapper mapper;

    public GoodsFindController(IGoodsFindService goodsFindService, ObjectMapper mapper) {
        this.goodsFindService = goodsFindService;
        this.mapper = mapper;
    }

    @PostMapping("goodsSearch")
    Result goodsSearch(String searchTxt,String userId) {
        if (log.isInfoEnabled()) {
            log.info("搜索商品接口 入参：" + searchTxt);
        }
        if (StringUtils.isEmpty(searchTxt)){
            return Result.ok("400",false, LinkedPrompt.PARAMS_EMPTY,null);
        }
        searchTxt = searchTxt.trim();

        GoodsFindPO find = new GoodsFindPO();
        find.setFindText(searchTxt);
        find.setUserId(userId);

    
        /**
         * 1、先查询种类
         * */

        /**
         * 2、查询品牌
         * */

        /**
         * 3、查询商品名称
         * */






        return Result.success();
    }
}
